/////////////////////////////////////////////////////////////////////////////
// Name:        commandeditorpanel.h
// Purpose:     
// Author:      Julian Smart
// Modified by: 
// Created:     22/11/2008 13:32:13
// RCS-ID:      
// Copyright:   (c) Anthemion Software Limited
// Licence:     New BSD License
/////////////////////////////////////////////////////////////////////////////

#ifndef _COMMANDEDITORPANEL_H_
#define _COMMANDEDITORPANEL_H_


/*!
 * Includes
 */

////@begin includes
////@end includes

#include "commandeditor/commandeditor.h"
#include "uiutils/uicustomization.h"

/*!
 * Forward declarations
 */

////@begin forward declarations
class wxBoxSizer;
class wxFlexGridSizer;
////@end forward declarations

/// Styles
#define wxCOMMAND_EDITOR_VIEWERS_ONLY 0x0002

/*!
 * Control identifiers
 */

////@begin control identifiers
#define ID_COMMAND_EDITOR_PANEL 21000
#define ID_COMMAND_EDITOR_FILE_TYPES 21001
#define ID_COMMAND_EDITOR_ADD_TYPE 21002
#define ID_COMMAND_EDITOR_DELETE_TYPE 21003
#define ID_COMMAND_EDITOR_EDIT_TYPE 21008
#define ID_COMMAND_EDITOR_PANEL_VIEWER_COMBOCTRL 21004
#define ID_COMMAND_EDITOR_PANEL_VIEWER_EDIT 21005
#define ID_COMMAND_EDITOR_PANEL_EDITOR_COMBOCTRL 21006
#define ID_COMMAND_EDITOR_PANEL_EDITOR_EDIT 21007
#define SYMBOL_WXCOMMANDEDITORPANEL_STYLE wxRESIZE_BORDER|wxTAB_TRAVERSAL
#define SYMBOL_WXCOMMANDEDITORPANEL_TITLE _T("")
#define SYMBOL_WXCOMMANDEDITORPANEL_IDNAME ID_COMMAND_EDITOR_PANEL
#define SYMBOL_WXCOMMANDEDITORPANEL_SIZE wxSize(400, 300)
#define SYMBOL_WXCOMMANDEDITORPANEL_POSITION wxDefaultPosition
////@end control identifiers


/*!
 * wxCommandEditorPanel class declaration
 */

class wxCommandEditorPanel: public wxPanel
{    
    DECLARE_DYNAMIC_CLASS( wxCommandEditorPanel )
    DECLARE_EVENT_TABLE()

public:
    /// Constructors
    wxCommandEditorPanel();
    wxCommandEditorPanel( wxWindow* parent, wxWindowID id = SYMBOL_WXCOMMANDEDITORPANEL_IDNAME, const wxPoint& pos = SYMBOL_WXCOMMANDEDITORPANEL_POSITION, const wxSize& size = SYMBOL_WXCOMMANDEDITORPANEL_SIZE, long style = SYMBOL_WXCOMMANDEDITORPANEL_STYLE );

    /// Creation
    bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WXCOMMANDEDITORPANEL_IDNAME, const wxPoint& pos = SYMBOL_WXCOMMANDEDITORPANEL_POSITION, const wxSize& size = SYMBOL_WXCOMMANDEDITORPANEL_SIZE, long style = SYMBOL_WXCOMMANDEDITORPANEL_STYLE );

    /// Destructor
    ~wxCommandEditorPanel();

    /// Initialises member variables
    void Init();

    /// Creates the controls and sizers
    void CreateControls();

    /// Set/get command manager to manipulate
    wxEditorCommandManager* GetCommandManager() { return m_commandManager; }
    void SetCommandManager(wxEditorCommandManager* manager) { m_commandManager = manager; }

    /// Populate drop-down list of file types
    void PopulateFileTypes(int sel = -1);
    
    /// Show a particular file type
    void ShowFileType(int i);

    /// Use tooltips
    static void SetUseTooltips(bool useTooltips) { sm_useTooltips = useTooltips; }

    ///  Set UI customization
    static void SetUICustomization(wxUICustomization* uiCustomization) { m_uiCustomization = uiCustomization; }

////@begin wxCommandEditorPanel event handler declarations

    /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_COMMAND_EDITOR_FILE_TYPES
    void OnCommandEditorFileTypesSelected( wxCommandEvent& event );

    /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_COMMAND_EDITOR_ADD_TYPE
    void OnCommandEditorAddTypeClick( wxCommandEvent& event );

    /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_COMMAND_EDITOR_DELETE_TYPE
    void OnCommandEditorDeleteTypeClick( wxCommandEvent& event );

    /// wxEVT_UPDATE_UI event handler for ID_COMMAND_EDITOR_DELETE_TYPE
    void OnCommandEditorDeleteTypeUpdate( wxUpdateUIEvent& event );

    /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_COMMAND_EDITOR_EDIT_TYPE
    void OnCommandEditorEditTypeClick( wxCommandEvent& event );

    /// wxEVT_UPDATE_UI event handler for ID_COMMAND_EDITOR_EDIT_TYPE
    void OnCommandEditorEditTypeUpdate( wxUpdateUIEvent& event );

    /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_COMMAND_EDITOR_PANEL_VIEWER_COMBOCTRL
    void OnCommandEditorPanelViewerComboctrlSelected( wxCommandEvent& event );

    /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_COMMAND_EDITOR_PANEL_VIEWER_EDIT
    void OnCommandEditorPanelViewerEditClick( wxCommandEvent& event );

    /// wxEVT_UPDATE_UI event handler for ID_COMMAND_EDITOR_PANEL_VIEWER_EDIT
    void OnCommandEditorPanelViewerEditUpdate( wxUpdateUIEvent& event );

    /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_COMMAND_EDITOR_PANEL_EDITOR_COMBOCTRL
    void OnCommandEditorPanelEditorComboctrlSelected( wxCommandEvent& event );

    /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_COMMAND_EDITOR_PANEL_EDITOR_EDIT
    void OnCommandEditorPanelEditorEditClick( wxCommandEvent& event );

    /// wxEVT_UPDATE_UI event handler for ID_COMMAND_EDITOR_PANEL_EDITOR_EDIT
    void OnCommandEditorPanelEditorEditUpdate( wxUpdateUIEvent& event );

////@end wxCommandEditorPanel event handler declarations

////@begin wxCommandEditorPanel member function declarations

    /// Retrieves bitmap resources
    wxBitmap GetBitmapResource( const wxString& name );

    /// Retrieves icon resources
    wxIcon GetIconResource( const wxString& name );
////@end wxCommandEditorPanel member function declarations

    /// Should we show tooltips?
    static bool ShowToolTips();

////@begin wxCommandEditorPanel member variables
    wxComboBox* m_commandEditorFileTypeCombo;
    wxBoxSizer* m_addDeleteTypeSizer;
    wxFlexGridSizer* m_flexGridSizer;
    wxComboBox* m_commandEditorViewerCombo;
    wxButton* m_commandEditorViewerEditCtrl;
    wxStaticText* m_editorsLabelCtrl;
    wxComboBox* m_commandEditorEditorCombo;
    wxButton* m_commandEditorEditorEditCtrl;
////@end wxCommandEditorPanel member variables

    wxEditorCommandManager* m_commandManager;

    bool                        m_noUpdates;
    static bool                 sm_useTooltips;
    static wxUICustomization*   m_uiCustomization;
};

#endif
    // _COMMANDEDITORPANEL_H_
